home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2006 May / PCWMAY06.iso / Software / Resources / Partition Logic 0.61 / partlogic-0.61.iso / system / headers / fcntl.h < prev    next >
C/C++ Source or Header  |  2006-01-31  |  4KB  |  99 lines

  1. // 
  2. //  Visopsys
  3. //  Copyright (C) 1998-2006 J. Andrew McLaughlin
  4. //  
  5. //  This library is free software; you can redistribute it and/or modify it
  6. //  under the terms of the GNU Lesser General Public License as published by
  7. //  the Free Software Foundation; either version 2.1 of the License, or (at
  8. //  your option) any later version.
  9. //
  10. //  This library is distributed in the hope that it will be useful, but
  11. //  WITHOUT ANY WARRANTY; without even the implied warranty of
  12. //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
  13. //  General Public License for more details.
  14. //
  15. //  You should have received a copy of the GNU Lesser General Public License
  16. //  along with this library; if not, write to the Free Software Foundation,
  17. //  Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18. //
  19. //  fcntl.h
  20. //
  21. //  The information gathered here and some of the descriptions are from
  22. //  http://www.opennc.org/onlinepubs/7908799/xsh/fcntl.h.html
  23. //  Copyright (C) 1997 The Open Group
  24. //
  25.  
  26. // This header defines the following requests and arguments for use by the
  27. // functions fcntl() and open().  
  28.  
  29. #if !defined(_FCNTL_H)
  30.  
  31. // Values for cmd used by fcntl() (the following values are unique): 
  32. #define F_DUPFD     0x01  // Duplicate file descriptor 
  33. #define F_GETFD     0x02  // Get file descriptor flags 
  34. #define F_SETFD     0x04  // Set file descriptor flags. 
  35. #define F_GETFL     0x08  // Get file status flags and file access modes. 
  36. #define F_SETFL     0x10  // Set file status flags. 
  37. #define F_GETLK     0x11  // Get record locking information. 
  38. #define F_SETLK     0x12  // Set record locking information. 
  39. #define F_SETLKW    0x14  // Set record locking information; wait if blocked. 
  40.  
  41. // File descriptor flags used for fcntl(): 
  42. #define FD_CLOEXEC  0x01   // Close the file descriptor upon execution of an
  43.                            // exec family function. 
  44.  
  45. // Values for l_type used for record locking with fcntl() (the following
  46. // values are unique): 
  47. #define F_RDLCK     0x01  // Shared or read lock. 
  48. #define F_UNLCK     0x02  // Unlock. 
  49. #define F_WRLCK     0x04  // Exclusive or write lock. 
  50.  
  51. // The values used for l_whence, SEEK_SET, SEEK_CUR and SEEK_END are
  52. // defined as described in <unistd.h>. 
  53.  
  54. // The following four sets of values for oflag are bitwise distinct: 
  55.  
  56. #define O_CREAT     0x01  // Create file if it does not exist. 
  57. #define O_EXCL      0x02  // Exclusive use flag. 
  58. #define O_NOCTTY    0x04  // Do not assign controlling terminal. 
  59. #define O_TRUNC     0x08  // Truncate flag. 
  60. #define O_DIRECTORY 0x10  // Fail if not a directory
  61.  
  62. // File status flags used for open() and fcntl(): 
  63. #define O_APPEND    0x11  // Set append mode. 
  64. #define O_DSYNC     0x12  // Write according to synchronised I/O data
  65.                           // integrity completion. 
  66. #define O_NONBLOCK  0x14  // Non-blocking mode. 
  67. #define O_RSYNC     0x18  // Synchronised read I/O operations. 
  68. #define O_SYNC      0x20  // Write according to synchronised I/O file
  69.                           // integrity completion. 
  70.  
  71. // Mask for use with file access modes: 
  72. #define O_ACCMODE   0x21  // Mask for file access modes. 
  73.  
  74. // File access modes used for open() and fcntl(): 
  75. #define O_RDONLY    0x22  // Open for reading only. 
  76. #define O_RDWR      0x24  // Open for reading and writing. 
  77. #define O_WRONLY    0x28  // Open for writing only. 
  78.  
  79. // The off_t, pid_t, and mode_t types are defined as described in
  80. // <sys/types.h>.
  81. #include <sys/types.h>
  82.  
  83. // The structure flock describes a file lock. It includes the following
  84. // members: 
  85. typedef struct {
  86.   short l_type;   // type of lock; F_RDLCK, F_WRLCK, F_UNLCK
  87.   short l_whence; // flag for starting offset
  88.   off_t l_start;  // relative offset in bytes
  89.   off_t l_len;    // size; if 0 then until EOF
  90.   pid_t l_pid;    // process ID of the process holding the lock; returned
  91.                   // with F_GETLK
  92. } flock;
  93.  
  94. // The following functions are supported
  95. int open(const char *, int);
  96.  
  97. #define _FCNTL_H
  98. #endif
  99.